package com.suxii.pojo;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class LoginMsg extends Msg{
    /*
    临时账号
     */
    /*
    qq,password
     */
    public static Map<Integer,String> users=new HashMap<>();

    static {
        users.put(123,"123");
        users.put(222,"123");
        users.put(333,"123");
    }

    @Override
    public int getType() {
        return LOGIN_MSG;
    }

    private String name;
    private int uid;
    private String password;

    public LoginMsg( int uid, String password) {
        this.uid = uid;
        this.password = password;
    }

    public static boolean isHava(int uid){
        return users.get(uid)!=null;
    }

    public static boolean isUser(int uid, String password){
        return users.get(uid).equals(password);
    }
}
